package mahan.data.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Images implements KeyValuePair {
	public static Images instance() {
		return new Images();
	}

	private int productID;
	private List<String> thumbnails = new ArrayList<String>();

	private List<String> largeImages = new ArrayList<String>();

	private Images() {
	}

	public Images(int productID) {
		this.productID = productID;
	}

	public Map<String, ?> get() {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("id", productID);
		map.put("thumb", thumbnails);
		map.put("large", largeImages);
		return map;
	}

	public List<String> getLargeImages() {
		return largeImages;
	}

	public int getProductID() {
		return productID;
	}

	public List<String> getThumbnails() {
		return thumbnails;
	}

	@SuppressWarnings("unchecked")
	public void put(Map<String, ?> map) {
		productID = (Integer) map.get("id");
		thumbnails = (List<String>) map.get("thumb");
		largeImages = (List<String>) map.get("large");
	}

	public void setLargeImages(List<String> largeImages) {
		this.largeImages = largeImages;
	}

	public void setThumbnails(List<String> thumbnails) {
		this.thumbnails.addAll(thumbnails);
	}
}